Manager: Memory Manager



Carbon supports the majority of the Memory Manager programming interface. Changes primarily affect applications that use zones, system memory, or temporary memory. For example, temporary memory allocations in Mac OS X are allocated in the application's address space. As a result, calling TempNewHandle is effectively the same as calling NewHandle.

Carbon does not support current functions for accessing the system heap, but on OS X, you can use the POSIX shared memory APIs to achieve this functionality. In addition, the virtual memory system in Mac OS X introduces a number of changes in the addressing model.

By adhering to the following guidelines, you can increase your application's compliance with Mac OS X memory management:

* Try to use memory only within your own application heap. Review the places where you allocate memory in the system heap.

* Do not pass pointers to data among applications through Apple events, Gestalt routines, or other means. For example, don't share Toolbox data structures between applications, because in Mac OS X, each application will run in its own protected address space.

* Do not use inline, hard-coded addresses.

* Do not modify the zone header by calling the MoreMasters function. You should instead call the function MoreMasterPointers. Note, however, that master pointer blocks do not need to be preallocated or optimized in the Mac OS X environment, so MoreMasterPointers will only benefit Carbon applications running on Mac OS 8.

* Don't make assumptions about the layout of memory, such as the relative position of data stored in heaps, stacks, and other memory areas.

* Don't use the DisposePtr or DisposeHandle functions on pointers or handles allocated by Toolbox managers. For example, don't call the function DisposeHandle on a control allocated by the NewControl function; use DisposeControl instead.

* Because Mac OS X applications run in a large, protected memory space, memory sizing routines such as MaxMem and FreeMem work differently than before.

Unsupported  ApplicationZone

Not available in Carbon.

Supported  BlockMove

Available in Mac OS 8.1 and later when Carbon 1.0.2 or later is present.

Supported  BlockMoveData

Available in Mac OS 8.1 and later when Carbon 1.0.2 or later is present.

Supported  BlockMoveDataUncached

Available in Mac OS 8.5 and later when Carbon 1.0.2 or later is present.

Supported  BlockMoveUncached

Available in Mac OS 8.5 and later when Carbon 1.0.2 or later is present.

Supported  BlockZero

Available in Mac OS 8.5 and later when Carbon 1.0.2 or later is present.

Supported  BlockZeroUncached

Available in Mac OS 8.5 and later when Carbon 1.0.2 or later is present.

Supported  CallGrowZoneProc

Supported  CallPurgeProc

Supported  CallUserFnProc

Supported  CheckAllHeaps

Available in Mac OS 8.1 and later when Carbon 1.0.2 or later is present.

Supported  CompactMem

Available in Mac OS 8.1 and later when Carbon 1.0.2 or later is present.

Unsupported  CompactMemSys

Operations on the system heap are not allowed. Not available in Carbon.

Unsupported  DebuggerEnter

Not available in Carbon.

Unsupported  DebuggerExit

Not available in Carbon.

Unsupported  DebuggerGetMax

Not available in Carbon.

Unsupported  DebuggerLockMemory

Not available in Carbon.

Unsupported  DebuggerPoll

Not available in Carbon.

Unsupported  DebuggerUnlockMemory

Not available in Carbon.

Unsupported  DeferUserFn

Not available in Carbon.

Supported  DisposeGrowZoneUPP

Available in Mac OS 8.1 and later when Carbon 1.0.2 or later is present.

Supported  DisposeHandle

Available in Mac OS 8.1 and later when Carbon 1.0.2 or later is present.

Supported  DisposePtr

Available in Mac OS 8.1 and later when Carbon 1.0.2 or later is present.

Supported  DisposePurgeUPP

Available in Mac OS 8.1 and later when Carbon 1.0.2 or later is present.

Supported  DisposeUserFnUPP

Available in Mac OS 8.1 and later when Carbon 1.0.2 or later is present.

Supported  EmptyHandle

Available in Mac OS 8.1 and later when Carbon 1.0.2 or later is present.

Unsupported  EnterSupervisorMode

Not available in Carbon.

Supported  FlushMemory

Available in Mac OS 8.5 and later when Carbon 1.0.2 or later is present.

Supported  FreeMem

Available in Mac OS 8.1 and later when Carbon 1.0.2 or later is present.

Unsupported  FreeMemSys

Operations on the system heap are not allowed in Carbon. Not available in Carbon.

Unsupported  GetApplLimit

Not available in Carbon.

Under Evaluation  GetGrowZone

Available in CarbonLib 1.1 and later when Carbon 1.1 or later is present.

Supported  GetHandleSize

Available in Mac OS 8.1 and later when Carbon 1.0.2 or later is present.

Unsupported  GetPageState

Not available in Carbon.

Unsupported  GetPhysical

Not available in Carbon.

Supported  GetPtrSize

Available in Mac OS 8.1 and later when Carbon 1.0.2 or later is present.

Under Evaluation  GetVolumeVirtualMemoryInfo

Not available in Carbon.

Unsupported  GetZone

Not available in Carbon.

Supported  GrowZoneProcPtr

Supported  GZSaveHnd

Available in Mac OS 8.1 and later when Carbon 1.0.2 or later is present.

Supported  HandAndHand

Available in Mac OS 8.1 and later when Carbon 1.0.2 or later is present.

Unsupported  HandleZone

Not available in Carbon.

Supported  HandToHand

Available in Mac OS 8.1 and later when Carbon 1.0.2 or later is present.

Supported  HClrRBit

Available in Mac OS 8.1 and later when Carbon 1.0.2 or later is present.

Supported  HGetState

Available in Mac OS 8.1 and later when Carbon 1.0.2 or later is present.

Supported  HLock

Available in Mac OS 8.1 and later when Carbon 1.0.2 or later is present.

Supported  HLockHi

Available in Mac OS 8.1 and later when Carbon 1.0.2 or later is present.

Supported  HNoPurge

Available in Mac OS 8.1 and later when Carbon 1.0.2 or later is present.

Unsupported  HoldMemory

Not available in Carbon.

Supported  HPurge

Available in Mac OS 8.1 and later when Carbon 1.0.2 or later is present.

Supported  HSetRBit

Available in Mac OS 8.1 and later when Carbon 1.0.2 or later is present.

Supported  HSetState

Available in Mac OS 8.1 and later when Carbon 1.0.2 or later is present.

Supported  HUnlock

Available in Mac OS 8.1 and later when Carbon 1.0.2 or later is present.

Unsupported  InitApplZone

Not available in Carbon.

Unsupported  InitZone

Not available in Carbon.

Unsupported  InlineGetHandleSize

Used by 68K code. Not available in Carbon.

Supported  InvokeGrowZoneUPP

Available in Mac OS 8.1 and later when Carbon 1.0.2 or later is present.

Supported  InvokePurgeUPP

Available in Mac OS 8.1 and later when Carbon 1.0.2 or later is present.

Supported  InvokeUserFnUPP

Available in Mac OS 8.1 and later when Carbon 1.0.2 or later is present.

Supported  IsHandleValid

Available in Mac OS 8.1 and later when Carbon 1.0.2 or later is present.

Supported  IsHeapValid

Available in Mac OS 8.1 and later when Carbon 1.0.2 or later is present.

Supported  IsPointerValid

Available in Mac OS 8.1 and later when Carbon 1.0.2 or later is present.

Unsupported  LockMemory

Not available in Carbon.

Unsupported  LockMemoryContiguous

Not available in Carbon.

Unsupported  LockMemoryForOutput

Not available in Carbon.

Supported  MakeMemoryNonResident

Available in Mac OS 8.5 and later when Carbon 1.0.2 or later is present.

Supported  MakeMemoryResident

Available in Mac OS 8.5 and later when Carbon 1.0.2 or later is present.

Unsupported  MaxApplZone

This routine is not needed by PowerPC-based applications because they can specify a stack size in the cfrg resource. Not available in Carbon.

Supported  MaxBlock

Available in Mac OS 8.1 and later when Carbon 1.0.2 or later is present.

Unsupported  MaxBlockSys

Not available in Carbon.

Supported  MaxMem

Available in Mac OS 8.1 and later when Carbon 1.0.2 or later is present.

Unsupported  MaxMemSys

Not available in Carbon.

Supported  MemError

Available in Mac OS 8.1 and later when Carbon 1.0.2 or later is present.

Supported  MoreMasterPointers

Carbon applications should use this function instead of MoreMasters to allocate a nonrelocatable block of master pointers in the current heap zone. Available in Mac OS 8.1 and later when Carbon 1.0.2 or later is present.

Not Recommended  MoreMasters

You should instead use MoreMasterPointers. Available in Mac OS 8.1 and later when Carbon 1.0.2 or later is present.

Supported  MoveHHi

Available in Mac OS 8.1 and later when Carbon 1.0.2 or later is present.

Supported  NewEmptyHandle

Available in Mac OS 8.1 and later when Carbon 1.0.2 or later is present.

Unsupported  NewEmptyHandleSys

Not available in Carbon.

Supported  NewGrowZoneProc

Supported  NewGrowZoneUPP

Available in Mac OS 8.1 and later when Carbon 1.0.2 or later is present.

Supported  NewHandle

Available in Mac OS 8.1 and later when Carbon 1.0.2 or later is present.

Supported  NewHandleClear

Available in Mac OS 8.1 and later when Carbon 1.0.2 or later is present.

Unsupported  NewHandleSys

Not available in Carbon.

Unsupported  NewHandleSysClear

Not available in Carbon.

Supported  NewPtr

Available in Mac OS 8.1 and later when Carbon 1.0.2 or later is present.

Supported  NewPtrClear

Available in Mac OS 8.1 and later when Carbon 1.0.2 or later is present.

Unsupported  NewPtrSys

Not available in Carbon.

Unsupported  NewPtrSysClear

Not available in Carbon.

Supported  NewPurgeProc

Supported  NewPurgeUPP

Available in Mac OS 8.1 and later when Carbon 1.0.2 or later is present.

Supported  NewUserFnProc

Supported  NewUserFnUPP

Available in Mac OS 8.1 and later when Carbon 1.0.2 or later is present.

Unsupported  PageFaultFatal

Not available in Carbon.

Supported  PtrAndHand

Available in Mac OS 8.1 and later when Carbon 1.0.2 or later is present.

Supported  PtrToHand

Available in Mac OS 8.1 and later when Carbon 1.0.2 or later is present.

Supported  PtrToXHand

Available in Mac OS 8.1 and later when Carbon 1.0.2 or later is present.

Unsupported  PtrZone

Not available in Carbon.

Supported  PurgeMem

Available in Mac OS 8.1 and later when Carbon 1.0.2 or later is present.

Unsupported  PurgeMemSys

Not available in Carbon.

Supported  PurgeProcPtr

Supported  PurgeSpace

Available in Mac OS 8.1 and later when Carbon 1.0.2 or later is present.

Supported  PurgeSpaceContiguous

Available in Mac OS 8.5 and later when Carbon 1.0.2 or later is present.

Unsupported  PurgeSpaceSysContiguous

Not available in Carbon.

Unsupported  PurgeSpaceSysTotal

Not available in Carbon.

Supported  PurgeSpaceTotal

Available in Mac OS 8.5 and later when Carbon 1.0.2 or later is present.

Supported  ReallocateHandle

Available in Mac OS 8.1 and later when Carbon 1.0.2 or later is present.

Unsupported  ReallocateHandleSys

Not available in Carbon.

Supported  RecoverHandle

Available in Mac OS 8.1 and later when Carbon 1.0.2 or later is present.

Unsupported  RecoverHandleSys

Not available in Carbon.

Supported  ReleaseMemoryData

Available in Mac OS 8.5 and later when Carbon 1.0.2 or later is present.

Supported  ReserveMem

Available in Mac OS 8.1 and later when Carbon 1.0.2 or later is present.

Unsupported  ReserveMemSys

Not available in Carbon.

Unsupported  SetApplBase

Not available in Carbon.

Unsupported  SetApplLimit

Not available in Carbon.

Supported  SetGrowZone

Available in Mac OS 8.1 and later when Carbon 1.0.2 or later is present.

Supported  SetHandleSize

Available in Mac OS 8.1 and later when Carbon 1.0.2 or later is present.

Supported  SetPtrSize

Available in Mac OS 8.1 and later when Carbon 1.0.2 or later is present.

Unsupported  SetZone

Not available in Carbon.

Supported  StackSpace

Available in Mac OS 8.1 and later when Carbon 1.0.2 or later is present.

Unsupported  StripAddress

There will be no 24-bit memory mode in Mac OS X, so there will be no 24-bit addresses to strip.

Unsupported  SystemZone

Not available in Carbon.

Supported  TempDisposeHandle

Available in Mac OS 8.1 and later when Carbon 1.0.2 or later is present.

Supported  TempFreeMem

Available in Mac OS 8.1 and later when Carbon 1.0.2 or later is present.

Supported  TempHLock

Available in Mac OS 8.1 and later when Carbon 1.0.2 or later is present.

Supported  TempHUnlock

Available in Mac OS 8.1 and later when Carbon 1.0.2 or later is present.

Supported  TempMaxMem

Available in Mac OS 8.1 and later when Carbon 1.0.2 or later is present.

Supported  TempNewHandle

Temporary memory allocations will actually come from the applications's address space in Mac OS X. However, Carbon applications running under Mac OS 8.x will be able to get true temporary memory. Available in Mac OS 8.1 and later when Carbon 1.0.2 or later is present.

Supported  TempTopMem

Available in Mac OS 8.1 and later when Carbon 1.0.2 or later is present.

Supported  TopMem

Available in Mac OS 8.1 and later when Carbon 1.0.2 or later is present.

Unsupported  Translate24To32

There will be no 24-bit memory mode in Mac OS X, so there is no need to translate from 24- to 32-bit addresses.

Unsupported  UnholdMemory

Not available in Carbon.

Unsupported  UnlockMemory

Not available in Carbon.

Supported  UserFnProcPtr

[Table of Contents] [Manager Index] [Function Index]

Generated on: 5/11/2000. Copyright © 1999, 2000 Apple Computer, Inc. All rights reserved.